﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    public class AlphaMaskEffectData : EffectTwoSourceData
    {
        public override ICanvasImage GetEffect(CanvasDevice device, bool compression)
        {
            if (InputEffectData == null)
            {
                Size = new Windows.Foundation.Size(0, 0);
                return null;

            }

            var source = GetSourceEffect(device, compression);
            if (source == null)
            {
                Size = new Windows.Foundation.Size(0, 0);
                return null;

            }

            var twoSource = GetSourceTwoEffect(device, compression);
            AlphaMaskEffect effect = new AlphaMaskEffect()
            {
                Source = source,
                AlphaMask = twoSource,
            };


            return effect;
        }
    }
}
